{% extends 'base.html' %}
{% load humanize %}
{% block page-content %}
{% include 'nav_cat_bar.html' %}
{% load mytags %}


<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>配置文件更新状态</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">Config option 1</a>
                            </li>
                            <li><a href="#">Config option 2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="row">

                    </div>
                    <div class="table-responsive">
                        <div id="txtHint">
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th class="text-center">地区</th>
                                <th class="text-center">平台</th>
                                <th class="text-center">数据库地址</th>
                                <th class="text-center">区服</th>
                                <th class="text-center">状态</th>
                                <th class="text-center">日志</th>
                                <th class="text-center">更新时间</th>
                            </tr>
                            </thead>
                            <tbody>
                                {% for num in status_info %}
                                    <tr class="text-center">
                                        <td>{{num.area_name}}</td>
                                        <td>{{num.platform}}</td>
                                        <td>{{num.}}</td>
                                        <td>{{num.server_name}}</td>
                                        <td >
                                            <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: {{num.status}}">{{num.status}}</div>
                                        </td>
                                        <td>{{num.log}}</td>
                                        <td>{{num.update_time|print_time}}</td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
        {
        xmlhttp=new XMLHttpRequest();
        }
else
        {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
xmlhttp.onreadystatechange=function()
        {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
                {
                document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                }
        }
xmlhttp.open("GET","/inc/update_process/?project={{project}}&type=sql_update&platform={{platform}}&update_time={{update_time}}",true);
xmlhttp.send()
}
</script>
<br>
<br>
<SCRIPT LANGUAGE="JavaScript">
    function CountDown()
    {
            loadXMLDoc();
            //document.getElementById("demo").innerHTML=loadXMLDoc();
            // console.log(document.getElementById("txtHint").innerHTML);

    }
    timer = setInterval("CountDown()",2000);
</SCRIPT>

{%endblock%}